function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return decodeURI(r[2]);
    return null;
}
//点击选择和取消选择操作
$(document).on("click", ".kgStickyNoteBtn", function () {
    var dataNum = $(this).attr("data-num");

    if (dataNum == 1) {
        // alert(123)
        $(this).removeClass("kgStickyNoteBtnSelect");
        $(this).attr("data-num", 0);
    } else {
        // alert(123)
        $(this).addClass("kgStickyNoteBtnSelect");
        $(this).attr("data-num", 1);
    }

    var toteNum = $(".kgStickyNoteBtn").length;
    var selectNum = $(".kgStickyNoteBtnSelect").length;

    if (toteNum == selectNum) {
        $(this).parent().parent().prev(".kgStickyNoteHead").find("input").prop("checked", true);
    } else {
        $(this).parent().parent().prev(".kgStickyNoteHead").find("input").prop("checked", false);
    }
})
$(function () {
    var width = $(".kgView-box").width();
    var height = $(window).height();
    // $(".kgViewLeft-box").width(width - 233);
    $(".kgViewLeft-box").height(height - 84);
    $(".kgViewRight-box").height(height - 84);
    $(".kgViewImgBox").height(height - 90);
    // $("#d3").width(width - 233);
    $("#svg,#d3").width('100%');
    $("#svg,#d3").height(height - 90);
    // $("#canvas").width(width - 233);
    $("#canvas").height(height - 90);
    //临时放于此部分代码需要放到公共文件
    var slideHeight = 70; // px
    var defHeight = $('#kgWrap').height() + 20;
    var defHeight2 = $('#kgWrap2').height() + 20;
    // console.log(defHeight2)
    // console.log(slideHeight)
    if (defHeight >= slideHeight) {
        $('#kgWrap').css('height', slideHeight + 'px');
        $('#kgRead-more').append('<a href="#">展开</a>');
        $('#kgRead-more a').click(function () {
            var curHeight = $('#kgWrap').height() + 20;
            console.log(curHeight)
            if (curHeight == slideHeight) {
                $('#kgWrap').animate({
                    height: defHeight
                }, "normal");
                $('#kgWrap .kgStickyNoteBox').css("overflow-y", "auto");
                $('#kgRead-more a').html('收回');
                $('#kgGradient').fadeOut();
            } else {
                $('#kgWrap').animate({
                    height: slideHeight
                }, "normal");
                $('#kgWrap .kgStickyNoteBox').css("overflow-y", "auto");
                $('#kgRead-more a').html('展开');
                $('#kgGradient').fadeIn();
            }
            return false;
        });
    }
    if (defHeight2 >= slideHeight) {
        $('#kgWrap2').css('height', slideHeight + 'px');
        $('#kgRead-more2').append('<a href="#">展开</a>');
        $('#kgRead-more2 a').click(function () {
            var curHeight = $('#kgWrap2').height() + 20;
            if (curHeight == slideHeight) {
                $('#kgWrap2').animate({
                    height: defHeight
                }, "normal");
                $('#kgWrap2 .kgStickyNoteBox').css("overflow-y", "auto");
                $('#kgRead-more2 a').html('收回');
                $('#kgGradient2').fadeOut();
            } else {
                // console.log(123)
                $('#kgWrap2').animate({
                    height: slideHeight
                }, "normal");
                $('#kgWrap2 .kgStickyNoteBox').css("overflow-y", "auto");
                $('#kgRead-more2 a').html('展开');
                $('#kgGradient2').fadeIn();
            }
            return false;
        });
    }
})